<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/11 0011
 * Time: 上午 9:34
 */

?>

<style>
    .time_card {
        border-radius: 4px;
        background-color: white;
        margin-top: 10px;
    }

    .statics {
        /*border-top: 4px solid #eee;*/
        /*border-bottom: 4px solid #eee;*/
        text-align: center;
        margin: 20px 0 0 0;
        padding-top: 10px;
        color: white;
        border-radius: 0 0 4px 4px;
    }

    .statics_number {
        font-weight: bold;
        font-size: 18px;
    }

</style>

<div class="time_card">

    <p style="text-align: center; padding: 10px;font-size: 18px;font-weight: bold">
        <?= $activity->title ?>
    </p>

    <div id="dateShow2" style="text-align: center">

        <!--    <img class="icon" src="/images/common/clock.png">-->
        <span id="dataInfoShow_2">活动已结束</span>
        <span class="date-tiem-span d">00</span>天
        <span class="date-tiem-span h">00</span>时
        <span class="date-tiem-span m">00</span>分
        <span class="date-s-span s">00</span>秒
    </div>

    <div class="row statics main-bg-color">
        <div class="col-xs-4">
            <div>
                <p class="statics_number"><?= $activity->view_number ?></p>
                <p><?= Yii::t('app.c2', 'Total View') ?></p>
            </div>
        </div>
        <div class="col-xs-4">
            <div class="separator">
                <p class="statics_number"><?= $activity->vote_number ?></p>
                <p><?= Yii::t('app.c2', 'Total Vote') ?></p>
            </div>
        </div>
        <div class="col-xs-4">
            <div class="separator">
                <p class="statics_number"><?= $activity->share_number ?></p>
                <p><?= Yii::t('app.c2', 'Total Share') ?></p>
            </div>
        </div>

    </div>

</div>


<?php
$js = <<<JS
    var clearTime = 0;
    function setDateImportFn(){
        //清除时间
        window.clearInterval(clearTime);
        /*== 获取数据 ==*/
        var data2={};
        //开始时间
        data2.startdate='<?= $activity->start_at ?>';
        //结束时间
        data2.enddate='<?= $activity->end_at ?>';
        //是否跳过开始
        data2.init=true;
        clearTime2=$.leftTime(data2,function(d){
            if(d.status){
                var dateShow1=$("#dateShow2");
                dateShow1.find(".d").html(d.d);
                dateShow1.find(".h").html(d.h);
                dateShow1.find(".m").html(d.m);
                dateShow1.find(".s").html(d.s);
                switch(d.step){
                    case 1:
                    $("#dataInfoShow_2").html("距离开始时间");
                    break;
                    case 2:
                    $("#dataInfoShow_2").html("距活动结束时间");
                    break;
                    case 3:
                    $("#dataInfoShow_2").html("活动已结束");
                    break;
                    default: 
                    $("#dataInfoShow_2").html("");
                     break;
                }
            }
        }, true);
    }
//初始化
setDateImportFn();
JS;
$this->registerJS($js);
?>